package com.xigua._多线程;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author LiRongHua
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2022/3/223:29
 */
public class _1114_按序打印 {



}

class Foo {

    private AtomicInteger status = new AtomicInteger(0);

    public Foo() {

    }

    public void first(Runnable printFirst) throws InterruptedException {

        // printFirst.run() outputs "first". Do not change or remove this line.
        printFirst.run();
        status.incrementAndGet();
    }

    public void second(Runnable printSecond) throws InterruptedException {
        if (status.get() != 1) {

        }
        // printSecond.run() outputs "second". Do not change or remove this line.
        printSecond.run();
        status.incrementAndGet();
    }

    public void third(Runnable printThird) throws InterruptedException {
        if (status.get() != 2){

        }
        // printThird.run() outputs "third". Do not change or remove this line.
        printThird.run();
    }
}
